import static sdl3.SDL_h.SDL_Quit;

// --enable-native-access=ALL-UNNAMED
public final class Sdl3Test {
	static void main() throws Exception {
		try (final var sound = new Sdl3Opa.OpaSound("res/demo.opa");
			 final var audio = new Sdl3Audio();
			 final var device = audio.createDevice(48000);
			 final var stream = device.borrowStream()) {
			stream.play(sound);
			Thread.sleep(5000);
			stream.stop();
			System.out.println(System.nanoTime() + ": ---");
			stream.play(sound);
			for (; ; ) {
				final var seconds = stream.getSecondPos();
				if (seconds < 0)
					break;
				System.out.println(seconds);
				//noinspection BusyWait
				Thread.sleep(1000);
			}
		}
		SDL_Quit();
		System.out.println("END");
	}
}
